home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr47 / wasm223.zip / START.ASM < prev    next >
Assembly Source File  |  1993-05-04  |  2KB  |  63 lines

  1. ;*****************************************;
  2. ; WASM Start-Up Module                    ;
  3. ; By Eric Tauck                           ;
  4. ;                                         ;
  5. ; This code verifies that DOS version 3   ;
  6. ; or higher is running and reduces the    ;
  7. ; memory allocation to a minimum. The     ;
  8. ; default stack size may be modified by   ;
  9. ; changing the STACK_SIZE equate below.   ;
  10. ;*****************************************;
  11.  
  12. STACK_SIZE      EQU     4096    ;bytes reserved for stack, can be changed
  13.  
  14. ;--- check DOS version
  15.  
  16.         mov     ah, 30H         ;get OS version function
  17.         int     21H             ;execute
  18.         cmp     al, 3           ;check if at least version 3
  19.         jb      _sartu1         ;jump if not
  20.  
  21. ;--- set up memory allocation
  22.  
  23.         mov     ax, $END        ;load offset of end of program
  24.         add     ax, STACK_SIZE  ;add space for stack
  25.         mov     cl, 4
  26.         shr     ax, cl          ;convert to paragraph form
  27.         inc     ax              ;round up
  28.         mov     bx, ax          ;save paragraphs
  29.         shl     ax, cl
  30.         cmp     ax, sp          ;check if out of memory already
  31.         ja      _sartu2         ;exit if so
  32.         mov     sp, ax          ;set up new stack
  33.  
  34. ;--- reduce memory allocation
  35.  
  36.         mov     ah, 4AH         ;modify memory allocation function
  37.         int     21H             ;execute
  38.         jc      _sartu2         ;jump if error
  39.  
  40.         jmps    _start_end
  41.  
  42. ;--- wrong DOS version
  43.  
  44. _sartu1 mov     ah, 9                   ;display message function
  45.         mov     dx, OFFSET _stup_mes1   ;address of message
  46.         int     21H                     ;execute
  47.         int     20H                     ;terminate
  48.  
  49. ;--- not enough memory
  50.  
  51. _sartu2 mov     ah, 9                   ;display message function
  52.         mov     dx, OFFSET _stup_mes2   ;address of message
  53.         int     21H                     ;execute
  54.         mov     ax, 4CFFH               ;exit with error code
  55.         int     21H                     ;execute
  56.  
  57. ;--- data
  58.  
  59. _stup_mes1      DB      'Requires DOS 3.0',13,10,'$'
  60. _stup_mes2      DB      'Not enough memory',13,10,'$'
  61.  
  62. _start_end
  63.